
"""
Specifies several types of weapons. Base classes in the combatClasses module
"""

from dice import *
from combatClasses import RangedWeapon, MeleeWeapon
import logging, random

class Pistol(RangedWeapon):
    logger = logging.getLogger('engine.Pistol')
    toHitDice = Dice('2d6')
    criticalMiss = 3
    criticalHit = 12
    obscuredPenalty = 1
    range = 6
    accuracyLostPerInch = 2
    criticalMissDamage = 1
    normalHitDamage = 2
    criticalHitDamage = 4
    toParryDice = Dice('2d9')
    parryOn = 11
    operable = True

class Rifle(RangedWeapon):
    logger = logging.getLogger('engine.Rifle')
    toHitDice = Dice('2d9')
    criticalMiss = 3
    criticalHit = 17
    obscuredPenalty = 2
    range = 8
    accuracyLostPerInch = .5
    criticalMissDamage = 2
    normalHitDamage = 3
    criticalHitDamage = 6
    toParryDice = Dice('2d9')
    parryOn = 7
    operable = True

class Cannon(RangedWeapon):
    """
    A regular cannon that aims at the hull of a ship. Other variations to come 
    later (maybe).
    """
    logger = logging.getLogger('engine.Cannon')
    toHitDice = Dice('2d4')
    criticalMiss = 3
    criticalHit = 8
    obscuredPenalty = 0
    range = 18
    accuracyLostPerInch = .125
    criticalMissDamage = 0
    normalHitDamage = 10
    criticalHitDamage = 20
    def parry(self):
        return False


class Cutlass(MeleeWeapon):
    logger = logging.getLogger('engine.Cutlass')
    toHitDice = Dice('2d9')
    criticalMiss = 3
    toHit = 11
    criticalHit = 17
    range = 1
    criticalMissDamage = 1
    damageMin = 1
    damageMax = 5
    toParryDice = Dice('2d9')
    parryOn = 10
    obscuredPenalty = 2

